<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="java.util.UUID"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>设备监测管理系统</title>
	<link rel="stylesheet" type="text/css" href="<%=this.getServletContext().getContextPath()%>/jsfiles/jquery-easyui-1.3.6/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=this.getServletContext().getContextPath()%>/jsfiles/jquery-easyui-1.3.6/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="<%=this.getServletContext().getContextPath()%>/jsfiles/jquery-easyui-1.3.6/demo/demo.css">
    
    <script type="text/javascript" src="<%=this.getServletContext().getContextPath()%>/jsfiles/jquery-easyui-1.3.6/jquery.min.js"></script>
	<script type="text/javascript" src="<%=this.getServletContext().getContextPath()%>/jsfiles/jquery-easyui-1.3.6/jquery.easyui.min.js"></script>
<!-- script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js"></script-->


<style type="text/css">
	body{
		margin-top: 0px;
		margin-left: 0px;
		margin-bottom: 0px;
		margin-right: 0px;
	}
	
	ul li{
		margin-top: 15;
		cursor: pointer;
	}
	
	.trowname{		
		text-align:right;
		margin-right:0px;
	}
	
</style>

<script type="text/javascript">
	
	/*
	*检测浏览器窗口大小改变,来改变页面layout大小
	*/
	$(document).ready(function (){
		$(window).resize(function(){
			$('#cc').layout('resize');
		});
		
		// 生成GUID
		 $("#btnNewGuid").click(function () {	    	
	    	<%UUID uuid = UUID.randomUUID();%>
	    	//alert("<%=uuid%>");
	    	$("#devguid").val("<%=uuid%>");
    	}); 
				    
	    $("#submit").click(function () {   
        	//必须先对提交表单数据数据进行序列化，采用jQuery的serialize()方法          	
        	var date=new Date();
        	$("#devjointime").val(date.toLocaleString());
        	var params = $("#fm").serialize(); 
 			alert( "params:" +params );   
        	$.ajax({       
	            url:'<%=this.getServletContext().getContextPath()%>/DeviceManage/DeviceManageAdd!addDevice',  
	            type:'post',  
	            data:params,  
	            dataType:'json',          
	            success:function (data) {
	                alert("SUCCESS");         
	            },
	            complete:function( XMLHttpRequest, textStatus ){
	            	alert("complete");   
	            },
	            error:function( XMLHttpRequest, textStatus, errorThrown){
	            	alert( "error:"+ errorThrown );
	            }    
        	});  
    	});  
	      
		
	});  
</script>


</head>
<body>  

	<h2>Modal Window</h2>
    <p>Click the open button below to open the modal window.</p>
    <div style="margin:20px 0;">
        <!-- a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#w').window('open')">Open</a-->
        <!--a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#w').window('close')">Close</a-->
    </div>
    <!-- class="easyui-window" data-options="modal:true,closed:false,iconCls:'icon-save'"-->
    <div id="winEditDev"  title="Modal Window"  style="width:500px;height:400px;padding:10px;margin-top:00px;">
        <div class="ftitle">设备信息</div>
        <form id="fm" method="post">
        	<table> 
        		<tr>
        			<td>		           
		                <label class="trowname">设备名:</label>
		            </td>
		            <td>
		                <input id="devname" name="device.name" value="大厅空调" />
		            </td>		           
		         </tr>
		         <tr>
		            <td>
		                <label class="trowname">设备GUID:</label>
		            </td>
		            <td>
		                <input id="devguid" name="device.guid" value="<%=uuid%>" />
		            </td>
		            <td>
		                <input id="btnNewGuid" type="button" value="生成" />
		            </td>	            
		        </tr>
		        <tr>
		            <td>
		                <label class="trowname">设备类型:</label> 
		            </td>
		            <td>
		                <input id="devport" name="device.type" value="1" />
		            </td>	         
		        </tr>
		        <tr>
		            <td>
		                <label class="trowname">隶属地区:</label> 
		            </td>
		            <td>
		                <input id="devownnode" name="device.ownnode" value="1" />
		            </td>	         
		        </tr>
		        
		        <tr>
		            <td>
		                <label class="trowname">IP:</label>
		            </td>
		            <td>
		                <input id="devip" name="device.ip" value="127001" />
		            </td>		            
		        </tr>
		        <tr>
		            <td>
		                <label class="trowname">Port:</label> 
		            </td>
		            <td>
		                <input id="devport" name="device.port" value="8080" />
		            </td>	         
		        </tr>
		        <tr>
		            <td>
		                <label class="trowname">连接类型:</label> 
		            </td>
		            <td>
		                <input id="devlinktype" name="device.linktype" value="3" />
		            </td>	         
		        </tr>
		         <tr>
		            <td>
		                <label class="trowname">添加时间:</label> 
		            </td>
		            <td>
		                <input id="devjointime"   name="device.jointime" value="0" />
		            </td>	         
		        </tr>
		        
		        <tr>
		        	<td>
		        		
		        	</td>
		        	<td style="text-align:right">
		        		<input id="submit" type="submit" value="提交" />
		        		<input id="reset" type="reset" value="重置" />
		        	</td>
		        	<td>
		        		
		        	</td>
		        </tr>
		        
	        </table>
        </form>
    </div>    
</body>
</html>